<?php

namespace Home\Model;

class LogsModel extends CommonModel
{
    public function log($userId, $model, $content)
    {
        if (!is_string($content)) {
            $content = json_encode($content);
        }

        $this->user_id = $userId;
        $this->model = $model;
        $this->content = $content;
        $this->created_at = time();
        $this->updated_at = time();

        return $this->add();
    }
}
